package com.kordar.api.modular.unicomJS;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 客户资料鉴权
 */
@Data
@TableName("unicomjs_customer_auth")
public class ZOPCheckAuthRequestImpl implements Request {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @NotEmpty(message = "{zop.provinceCode}{javax.validation.constraints.NotEmpty.message}")
    @Length(max = 2, min = 2, message = "{zop.provinceCode.size}")
    private String province;
    @NotEmpty(message = "{zop.cityCode}{javax.validation.constraints.NotEmpty.message}")
    @Size(max = 3, min = 3, message = "{zop.cityCode.size}")
    private String city;

    @NotEmpty(message = "{zop.certName}{javax.validation.constraints.NotEmpty.message}")
    private String certName;
    @NotEmpty(message = "{zop.certNum}{javax.validation.constraints.NotEmpty.message}")
    private String certNum;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    private String rspDesc;
    private String data;
    private String rspCode;

    /**
     * province	body	是	String		省分编码(3位)
     * city	body	是	String		地市编码(2位)
     * certName	body	是	String		证件姓名
     * certNum	body	是	String		证件编码
     * @return
     */
    @Override
    public JSONObject body() {
        JSONObject object = new JSONObject();
        object.put("province", province);
        object.put("city", city);
        object.put("certName", certName);
        object.put("certNum", certNum);
        return object;
    }

    @Override
    public String url() {
        return "http://58.240.52.214:80/jszop/zop_link/checkAuth?secretKey=" + SysParams.SYS_SECRET_KEY.getName();
    }
}
